//
// pch.h
//

#pragma once

#define _CRT_NONSTDC_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS

#ifdef _GTEST_

#include "gtest/gtest.h"
#include "gmock/gmock.h"

#define TEST_CLASS(x) namespace x
#define TEST_METHOD(x) TEST(x,x)
#define GTEST_COUT std::cerr << "[INFO]"
#define TEST_COUT(msg) GTEST_COUT << msg
#define TEST_COUT_D(x) GTEST_COUT << x
const char TEST_F[] = "gtest_";
#endif

#ifdef _MTEST_

#include "CppUnitTest.h"

#define TEST(iclass,ifunction)  public: TEST_METHOD(ifunction)
#define EXPECT_NEAR(x,y,e)  Assert::AreEqual(x, y, e)
#define EXPECT_EQ(x,y)  Assert::AreEqual(x, y)
#define EXPECT_TRUE(x)  Assert::IsTrue(x)
#define EXPECT_FALSE(x)  Assert::IsFalse(x)
#define TEST_COUT(msg) Logger::WriteMessage(msg)
#define TEST_COUT_D(x) Logger::WriteMessage((std::to_string(x)).c_str())

using namespace Microsoft::VisualStudio::CppUnitTestFramework;

const char TEST_F[] = "mtest_";

#endif // GTEST

#include <stdlib.h>
#include <cstdlib>
#include <functional>
#include <sstream>
#include <fstream>

const static std::string H_TestFramework()
{
	return std::string(TEST_F);
}

const static std::string H_TimeString()
{
	time_t timep;
	time(&timep);
	char str[255];
	sprintf(str, "%d", (int)timep);
	return std::string(str);
}

const static void H_print(int v)
{
	TEST_COUT_D(v);
}
const static void H_print(int v, bool value)
{
	TEST_COUT_D(v);
	if (value)
		TEST_COUT("\n");
}

const static void H_print(double v)
{
	TEST_COUT_D(v);
}
const static void H_print(double* v, int len)
{
	for (int i = 0; i < len; i++)
	{
		TEST_COUT_D(v[i]); TEST_COUT(",");
	}
}

const static void H_print(std::string v)
{
	TEST_COUT(v.c_str());
}
